#图像金字塔
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt

img=cv.imread('F:\\11\\19.png',1)
rows,cols=img.shape[:2]
img_up=cv.pyrUp(img)#对图像进行上采样
img_down=cv.pyrDown(img)#对图像进行下采样
def show(img,name):#利用matplotlib显示图像
    plt.imshow(img[:, :, ::-1])
    plt.title(name), plt.xticks([]), plt.yticks([])
    plt.show()

if __name__=="__main__":
    show(img_up,'enlager')
    show(img,'origin')
    show(img_down,'shrink')